// HSS.Forms.ConnectionStringOptions.cs
// ----------------------------------------------------------------------------
// Licensed under the MIT license
// http://www.opensource.org/licenses/mit-license.html
// ----------------------------------------------------------------------------
// HighSpeed-Solutions, LLC
// Copyright (c) 2001-2010
// ----------------------------------------------------------------------------
// File:       ConnectionStringOptions.cs
// Author:     HSS\gbanta
// Created:    08/12/2010
// Modified:   12/04/2010
// ----------------------------------------------------------------------------
namespace HSS.Forms
{
	#region Using Directives
	using System;
	using System.Collections.Generic;
	using System.ComponentModel;
	using System.Data;
	using System.Drawing;
	using System.Text;
	using System.Windows.Forms;
	#endregion

	#region ConnectionOptionsSQL
	/// <summary>
	/// User form to specify the options for an SQL Connection
	/// </summary>
	public partial class ConnectionStringOptions : Form
	{
		#region Constructors
		/// <summary>
		/// Constructor
		/// </summary>
		public ConnectionStringOptions()
		{
			InitializeComponent();
		}
		#endregion

		#region Properties
		/// <summary>
		/// Gets the Application Name to associate with the Connection String
		/// </summary>
		public string ApplicationName
		{
			get { return this.txtApplicationName.Text; }
		}
		/// <summary>
		/// Gets the Workstation Id to associate with the Connection String
		/// </summary>
		public string WorkstationId
		{
			get { return this.txtWorkStationID.Text; }
		}
		/// <summary>
		/// Gets the allowable time to connect to the Database
		/// </summary>
		public decimal ConnectionTimeout
		{
			get { return this.nudConnectionTimeout.Value; }
		}
		/// <summary>
		/// Gets the allowable time to execute a command
		/// </summary>
		public decimal CommandTimeout
		{
			get { return this.nudCommandTimeout.Value; }
		}
		#endregion

		#region Methods
		/// <summary>
		/// Loads the data into the Form using the specified values
		/// </summary>
		/// <param name="applicationName">The Application Name to associate with the Connection String</param>
		/// <param name="workstationId">The Workstation Id to associate with the Connection String</param>
		/// <param name="connectionTimeout">The allowable time to connect to the Database</param>
		/// <param name="commandTimeout">The allowable time to execute a command</param>
		public void LoadData(string applicationName, string workstationId, decimal connectionTimeout, decimal commandTimeout)
		{
			this.txtApplicationName.Text = applicationName;
			this.txtWorkStationID.Text = workstationId;
			this.nudConnectionTimeout.Value = connectionTimeout;
			this.nudCommandTimeout.Value = commandTimeout;
		}
		#endregion

		#region EventHandlers
		private void btnOK_Click(object sender, EventArgs e)
		{
			this.DialogResult = DialogResult.OK;
			this.Close();
		}
		#endregion
	}
	#endregion
}